﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace lcs.Web.inventory
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtmid.Text))
			{
				strErr+="mid格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtspid.Text))
			{
				strErr+="spid格式错误！\\n";	
			}
			if(!PageValidate.IsDecimal(txtnums.Text))
			{
				strErr+="nums格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int mid=int.Parse(this.txtmid.Text);
			int spid=int.Parse(this.txtspid.Text);
			decimal nums=decimal.Parse(this.txtnums.Text);

			lcs.Model.inventory model=new lcs.Model.inventory();
			model.mid=mid;
			model.spid=spid;
			model.nums=nums;

			lcs.BLL.inventory bll=new lcs.BLL.inventory();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","Add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("List.aspx");
        }
    }
}
